package com.taptech.doufu.ui.adapter;


import java.util.List;

import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentPagerAdapter;


public class CommonViewPagerAdapter extends FragmentPagerAdapter
{
    private String NAMESTRING_HOME[] = new String[]{"首页","连载","完结","言情"," IP合作 ","漫画"};
    private List<Fragment> mFragments = null;

    public CommonViewPagerAdapter(FragmentManager fm, List<Fragment> fragments, String[] titles) {
        super(fm);
        mFragments = fragments;
        NAMESTRING_HOME = titles;

    }

    public CommonViewPagerAdapter(FragmentManager fm, List<Fragment> fragments)
    {
        super(fm);
        mFragments = fragments;
    }



    @Override
    public Fragment getItem(int arg0)
    {
        // TODO Auto-generated method stub
        return mFragments.get(arg0);
    }

    @Override
    public int getCount()
    {
        // TODO Auto-generated method stub
        if (mFragments != null)
        {
            return mFragments.size();
        }
        return 0;
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return NAMESTRING_HOME[position];
    }
}